From: Keir Fraser Date: Fri, 8 Jan 2010 11:48:02 +0000 (+0000) Subject: libxenlight: don't try to delete path when they doesn't exists. X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~12765 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks://%22Dat/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22Dat?a=commitdiff_plain;h=718090f23e957e10c09dbd804859554fa1eb91b7;p=xen.git libxenlight: don't try to delete path when they doesn't exists. fix segfault in destroy when creation hasn't been done properly. Signed-off-by: Vincent Hanquez --- diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index c5f1fd8394..46dcebf76a 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -564,16 +564,19 @@ int libxl_domain_destroy(struct libxl_ctx *ctx, uint32_t domid, int force) XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "xs_rm failed for %s", dom_path); vm_path = libxl_xs_read(ctx, XBT_NULL, libxl_sprintf(ctx, "/local/domain/%d/vm", domid)); - if (!xs_rm(ctx->xsh, XBT_NULL, vm_path)) - XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "xs_rm failed for %s", vm_path); + if (vm_path) + if (!xs_rm(ctx->xsh, XBT_NULL, vm_path)) + XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "xs_rm failed for %s", vm_path); vss_path = libxl_xs_read(ctx, XBT_NULL, libxl_sprintf(ctx, "/local/domain/%d/vss", domid)); - if (!xs_rm(ctx->xsh, XBT_NULL, vss_path)) - XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "xs_rm failed for %s", vss_path); + if (vss_path) + if (!xs_rm(ctx->xsh, XBT_NULL, vss_path)) + XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "xs_rm failed for %s", vss_path); xapi_path = libxl_sprintf(ctx, "/xapi/%u", domid); - if (!xs_rm(ctx->xsh, XBT_NULL, xapi_path)) - XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "xs_rm failed for %s", xapi_path); + if (xapi_path) + if (!xs_rm(ctx->xsh, XBT_NULL, xapi_path)) + XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "xs_rm failed for %s", xapi_path); rc = xc_domain_destroy(ctx->xch, domid); if (rc < 0) {